FROM python:3.7-alpine as base

FROM base as build
WORKDIR /app
COPY requirements.txt ./
RUN pip install -r requirements.txt -i https://pypi.douban.com/simple/

FROM base as final
COPY --from=build /usr/local/lib/python3.7/site-packages /usr/local/lib/python3.7/site-packages
WORKDIR /app
ENV PYTHONUNBUFFERED=1
COPY .. .
CMD ["python3", "main.py"]